function [position,isterminal,direction] = JacobiCheck(~,S)
GM_sun=1.327124400*10^(11);     %Sun
GM_earth=3.986004418*10^(5);    %Earth
GM_moon = 4.9048695*10^(3);     %Moon
%[km^3/s^2] Gravitational Parameters
u_se = GM_earth / (GM_earth+GM_sun);% se --> Sun-Earth system

Jacobi = jacobiConst(S(1:3),S(4:6),u_se);

% 
% position = 3.0000045907012-Jacobi; % The value that we want to be zero
% position = 3.0000045907012-Jacobi; % The value that we want to be zero
position = 3.0007-Jacobi; % The value that we want to be zero
isterminal = 1;  % Halt integration 
direction = 0;   % The zero can be approached from either direction